public class ReplacingInStrings {

	public static void main(String[] args) {
		String text = "I    \t\t love      Java!";
		String pattern = "\\s+";
		String replacement = " ";
		String newText = text.replaceAll(pattern, replacement);
		System.out.println(newText);
	}

}
